package org.csmz.class2333.collection;

import java.util.ArrayList;
import java.util.List;

public class Example03 {
    public static void main (String[] args){
        List<Integer> list = new ArrayList<>();
        list.add(5);
        list.add(6);
        list.add(24);
        int sum = 0;
        for (Integer obj : list){
            sum += obj;
        }
        System.out.println("集合中所有数字的和为" +sum);
    }
}
